package reesoft.idgenerator.service.idstore;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * Created by reesoft on 2017-08-28
 */
@Configuration
@ConfigurationProperties(prefix = "id.store.httpRemoteIdStore")
public class HttpRemoteIdStoreConfig
{
    private String server = "http://127.0.0.1:8080";

    private String initUri = "/register";

    private String checkUri = "/check";

    private String nextUri = "/next";

    private String nextBatchUri = "/nextBatch";

    private int maxTryCount = 2;

    public String getServer()
    {
        return server;
    }

    public void setServer(String server)
    {
        this.server = server;
    }

    public String getInitUrl()
    {
        return server + initUri;
    }

    public void setInitUri(String initUri)
    {
        this.initUri = initUri;
    }

    public String getCheckUrl()
    {
        return server + checkUri;
    }

    public void setCheckUri(String checkUri)
    {
        this.checkUri = checkUri;
    }

    public String getNextUrl()
    {
        return server + nextUri;
    }

    public void setNextUri(String nextUri)
    {
        this.nextUri = nextUri;
    }

    public String getNextBatchUrl()
    {
        return server + nextBatchUri;
    }

    public void setNextBatchUri(String nextBatchUri)
    {
        this.nextBatchUri = nextBatchUri;
    }

    public int getMaxTryCount()
    {
        return maxTryCount;
    }

    public void setMaxTryCount(int maxTryCount)
    {
        if (maxTryCount > 0)
        {
            this.maxTryCount = maxTryCount;
        }
    }
}
